package org.mcflier.appuntamento.io.driver.imdb;

import java.util.List;
import java.util.Properties;

import org.mcflier.appuntamento.core.exception.PropertiesException;
import org.mcflier.appuntamento.data.model.Movie;
import org.mcflier.appuntamento.i18n.Country;
import org.mcflier.appuntamento.io.driver.imdb.interfaces.IIMDBDriver;
import org.mcflier.appuntamento.io.exception.MovieNotFoundException;
import org.mcflier.appuntamento.io.exception.ParsingException;
import org.mcflier.appuntamento.io.exception.RemoteConnectionException;
import org.mcflier.appuntamento.io.exception.RemoteResourceNotFoundException;

public abstract class AbstractIMDBDriver implements IIMDBDriver {
	
	private Properties properties;
	
	public AbstractIMDBDriver() {
		this.properties = null;
	}
	
	public void init(Properties properties) throws PropertiesException{
		this.setProperties(properties);
	}
	
	protected void setProperties(Properties properties){
		if(properties == null)
			throw new NullPointerException(this.getClass().getCanonicalName()+"Properties must not be null");
		
		this.properties = properties;
	}
	
	protected Properties getProperties(){
		return this.properties;
	}
	
	@Override
	public abstract Movie getMovie(String id) throws ParsingException, MovieNotFoundException, RemoteConnectionException;

	@Override
	public abstract List<Movie> getMovies(List<String> ids) throws ParsingException, RemoteConnectionException;

	@Override
	public abstract List<Movie> getShowtimes(Country country, String zipCode) throws PropertiesException, ParsingException, RemoteResourceNotFoundException, RemoteConnectionException;

	@Override
	public abstract List<Movie> getNowPlaying() throws ParsingException, RemoteConnectionException, RemoteResourceNotFoundException;

	@Override
	public abstract List<Movie> getNowPlaying(int page) throws ParsingException, RemoteConnectionException, RemoteResourceNotFoundException;
}
